#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <fcntl.h>
#include <errno.h>
#include <iostream>
#include <stdlib.h>


#ifndef __NCTUNS_nslsharedsemaphore_h__
#define __NCTUNS_nslsharedsemaphore_h__

#define KEY (1492)

union semun {
    int                 val;   /* value for SETVAL             */
    struct semid_ds    *buf;   /* buffer for IPC_STAT, IPC_SET */
    unsigned short     *array; /* array for GETALL, SETALL     */
    struct seminfo     __buf;  /* buffer for IPC info          */
};


class sharedSemaphore
{
private:
	key_t _sem_key;
	int _sem_id;

public:
    sharedSemaphore(  );
    ~sharedSemaphore( void );
    void wait( void );
    void signal( void );
};

//sharedSemaphore mutex_admission(1);

#endif  /* __NCTUNS_sharedsemaphore_h__ */
